home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #14 / Monster Media No. 14 (April 1996) (Monster Media, Inc.).ISO / maximus / fdomore.zip / FDOMORE.MEX next >
Text File  |  1996-02-19  |  7KB  |  162 lines

  1. //--------------------------------------------------------------------------//
  2. //                   FileDoMore v1.0 for Maximus v3                         //
  3. //                   by Chris Gerlinsky, 1:140/186                          //
  4. //                                                                          //
  5. // This is a MEX to be used after a list of files is shown to the user, it  //
  6. // will display More [Y,n,t,=]? prompt just as in the files listing, and    //
  7. // will allow users to tag files, etc..                                     //
  8. //                                                                          //
  9. // If you've tried Press_Enter and [more] commands for this purpose, you've //
  10. // likely noticed that if a user selects n at a no prompt, they will get an //
  11. // extra prompt - this should stop that from happening..                    //
  12. //                                                                          //
  13. // In your language file [ENGLISH.MAD], you must change the file_stats line //
  14. // to read as the following:                                                //
  15. //  @MEX file_stats=        "(%u) %-12s (%02u:%02u, %ld bytes)"             //
  16. //    (colours are OK, but there must be the @MEX, and the %u, %-12s,       //
  17. //    %02u (both), and %ld must be left alone)                              //
  18. //                                                                          //
  19. // Call this as in the following:(also suggested for locate, newfiles, etc) //
  20. //       File_Titles                             Demoted "File titles"      //
  21. // NoDsp MEX             M\Fdomore               Demoted "File titles"      //
  22. //                                                                          //
  23. // Thanks to Michael Nix (3:690/426) for pointing me towards xfertime()!    //
  24. //--------------------------------------------------------------------------//
  25.  
  26. #include <max.mh>
  27. #include <max_menu.mh>
  28.  
  29. #define INCL_global
  30. #define INCL_f_area
  31.  
  32. #include <language.mh>
  33.  
  34.  
  35. void main()
  36. {
  37.     char: nonstop;
  38.     int: inchar,numoftagged,flags,semiloc,mins,secs;
  39.     string: Yne,le_more_prompt,instr,file_stats,filename,holder;
  40.  
  41.     nonstop:=0;
  42.  
  43.     Yne:=str_MoreYnTag;
  44.  
  45.     le_more_prompt:=str_more_prompt;
  46.     le_more_prompt[strlen(le_more_prompt)+1]:=' ';
  47.     le_more_prompt[strlen(le_more_prompt)+1]:='[';
  48.     le_more_prompt[strlen(le_more_prompt)+1]:=Yne[1];
  49.     le_more_prompt[strlen(le_more_prompt)+1]:=',';
  50.     le_more_prompt[strlen(le_more_prompt)+1]:=Yne[2];
  51.     le_more_prompt[strlen(le_more_prompt)+1]:=',';
  52.     le_more_prompt[strlen(le_more_prompt)+1]:=Yne[3];
  53.     le_more_prompt[strlen(le_more_prompt)+1]:=',';
  54.     le_more_prompt[strlen(le_more_prompt)+1]:=Yne[4];
  55.     le_more_prompt[strlen(le_more_prompt)+1]:=']';
  56.     le_more_prompt[strlen(le_more_prompt)+1]:='?';
  57.     le_more_prompt[strlen(le_more_prompt)+1]:=' ';
  58.  
  59.     if(sys.more_lines<2)
  60.         return;
  61.  
  62.     donehit:
  63.  
  64.     inchar:=input_ch(CINPUT_DISPLAY|CINPUT_PROMPT|CINPUT_NOLF,le_more_prompt);
  65.     while(tolower(inchar)<>tolower(Yne[1]) and tolower(inchar)<>tolower(Yne[2]) and tolower(inchar)<>tolower(Yne[3]) and tolower(inchar)<>tolower(Yne[4]) and inchar<>13 and inchar<>'|')
  66.     {
  67.         inchar:=input_ch(CINPUT_DISPLAY|CINPUT_PROMPT|CINPUT_NOLF,str_useyforyesnst+le_more_prompt);
  68.     }
  69.  
  70.     if(tolower(inchar)=Yne[3])
  71.     {
  72.         print('\r',AVATAR_CLEOL);
  73.         numoftagged:=tag_queue_size();
  74.         input_str(instr,INPUT_NLB_LINE|INPUT_NOLF,0,256,"("+itostr(numoftagged+1)+") Filename to tag? ");
  75.  
  76.         if(strlen(instr)>0)
  77.             input:="a"+instr;
  78.         else
  79.             goto notag;
  80.  
  81.         set_output(DISABLE_BOTH);
  82.         menu_cmd(MNU_FILE_TAG,"");
  83.         set_output(DISABLE_NONE);
  84.  
  85.         notag:
  86.  
  87.         if(numoftagged<tag_queue_size())
  88.         {
  89.             while(numoftagged<tag_queue_size())
  90.             {
  91.                 numoftagged:=numoftagged+1;
  92.  
  93.                 file_stats:=str_file_stats;
  94.  
  95.                 semiloc:=strfind(file_stats,"%u");
  96.                 if(semiloc)
  97.                 {
  98.                     holder:=substr(file_stats,semiloc+2,strlen(file_stats)-semiloc-1);
  99.                     file_stats:=substr(file_stats,1,semiloc-1);
  100.                     file_stats:=file_stats+itostr(numoftagged)+holder;
  101.                 }
  102.  
  103.                 semiloc:=strfind(file_stats,"%ld");
  104.                 if(semiloc)
  105.                 {
  106.                     holder:=substr(file_stats,semiloc+3,strlen(file_stats)-semiloc-1);
  107.                     file_stats:=substr(file_stats,1,semiloc-1);
  108.                     tag_get_name(numoftagged-1,flags,filename);
  109.                     file_stats:=file_stats+ltostr(filesize(filename))+holder;
  110.                 }
  111.  
  112.                 secs:=xfertime(usr.def_proto,filesize(filename))%60;
  113.                 mins:=xfertime(usr.def_proto,filesize(filename))/60;
  114.  
  115.                 semiloc:=strfind(file_stats,"%02u");
  116.                 if(semiloc)
  117.                 {
  118.                     holder:=substr(file_stats,semiloc+4,strlen(file_stats)-semiloc-1);
  119.                     file_stats:=substr(file_stats,1,semiloc-1);
  120.                     if(mins>9)
  121.                         file_stats:=file_stats+itostr(mins)+holder;
  122.                     else
  123.                         file_stats:=file_stats+"0"+itostr(mins)+holder;
  124.                 }
  125.  
  126.                 semiloc:=strfind(file_stats,"%02u");
  127.                 if(semiloc)
  128.                 {
  129.                     holder:=substr(file_stats,semiloc+4,strlen(file_stats)-semiloc-1);
  130.                     file_stats:=substr(file_stats,1,semiloc-1);
  131.                     if(secs>9)
  132.                         file_stats:=file_stats+itostr(secs)+holder;
  133.                     else
  134.                         file_stats:=file_stats+"0"+itostr(secs)+holder;
  135.                 }
  136.  
  137.                 semiloc:=strfind(file_stats,"%-12s");
  138.                 if(semiloc)
  139.                 {
  140.                     holder:=substr(file_stats,semiloc+5,strlen(file_stats)-semiloc-1);
  141.                     file_stats:=substr(file_stats,1,semiloc-1);
  142.                     filename:=substr(filename,strridx(filename,0,'\\')+1,12);
  143.                     file_stats:=file_stats+filename+holder;
  144.                 }
  145.  
  146.                 print('\r',AVATAR_CLEOL,file_stats);
  147.             }
  148.         }
  149.         else
  150.         {
  151.             if(strlen(instr)>0)
  152.                 print('\r',AVATAR_CLEOL,COL_LRED,"Unable to tag file \"",instr,"\".\n",COL_WHITE);
  153.             else
  154.                 print('\r',AVATAR_CLEOL);
  155.         }
  156.  
  157.         goto donehit;
  158.     }
  159.  
  160.     return;
  161. }
  162.